using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace BB.Processes.Models.Mapping
{
    public class JornadaMap : EntityTypeConfiguration<Jornada>
    {
        public JornadaMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            // Table & Column Mappings
            this.ToTable("Jornadas");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.CompeticaoId).HasColumnName("CompeticaoId");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.Fulfilled).HasColumnName("Fulfilled");

            // Relationships
            this.HasOptional(t => t.Competicao)
                .WithMany(t => t.Jornadas)
                .HasForeignKey(d => d.CompeticaoId);

        }
    }
}
